<admintpl file="header" />
</head>

<body>
<div class="wrap js-check-wrap">
    <div class="wrap js-check-wrap">
        <ul class="nav nav-tabs">
            <li><a href="{:U('Message/Index')}">留言墙</a></li>
            <li><a href="{:U('Message/addwall')}">创建留言墙</a></li>
            <li class="active"><a href="{:U('Message/manage?wall_id='.$wall_id)}">留言管理</a></li>
            <li><a href="{:U('Message/addmessage?wall_id='.$wall_id)}">创建留言</a></li>
        </ul>
        <form class="form-horizontal js-ajax-form" action="{:U('Message/settypes')}" method="post">
            <div class="control-group">
                <label class="span1 control-label" style="width: 150px;">设置留言墙刷新：</label>
                <div class="span3" style="width: 500px;">
                    <foreach name="types" key="administrator_key" item="vo">
                        <input name="type_checbox[]"  type="checkbox"   style="margin-bottom: 5px;" value="{$vo.id}"  <?php if($vo['is_show'] == 1) echo 'checked="checked"  ';?>/>&nbsp;{$vo.name}&nbsp;&nbsp;&nbsp;&nbsp;
                    </foreach>
                </div><input type="text" name="set_time" value="{$fresh_time}" style="width: 50px;">&nbsp;秒刷新 &nbsp;&nbsp;&nbsp;&nbsp;<button type="submit" class="btn btn-primary js-ajax-submit">设置类型</button>
            </div>
            <input type="hidden" name="wall_id" value="{$wall_id}">

        </form>
        <form class="form-horizontal js-ajax-form" action="{:U('Message/manage')}" method="post">
            <table class="table table-hover table-bordered">
                <thead>
                <tr>
                    <th>用户名</th>
                    <th>头像</th>
                    <th>留言内容</th>
                    <th>创建时间</th>
                    <th>留言来源</th>
                    <th>类型</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <foreach name="list" item="vo">
                    <tr>
                        <td>{$vo.user_name}</td>
                        <td><img src="{$vo.photo}" style="width: 100px;height: 100px;"></td>
                        <td>{$vo.content} </td>
                        <td>{$vo.create_time}</td>
                        <td>{$vo.source}</td>
                        <td>{$vo.type}</td>
                        <td>
                            <a href="{:U('Message/editmessage?wall_id='.$wall_id.'&id='.$vo['id'])}" >编辑</a>&nbsp;&nbsp;
                            <a href='{:U("Admin/Message/del",array("wall_id"=>$wall_id,"id"=>$vo["id"]))}' class="js-ajax-dialog-btn"
                               data-msg="确定要删除此留言吗？">删除</a>&nbsp;&nbsp;
                            <a href='#' onclick="edit_type({$vo['id']},{$vo['type_id']})">设置类型</a>
                        </td>
                    </tr>
                </foreach>
                </tbody>
            </table>
            <input type="hidden" name="wall_id" value="{$wall_id}">
        </form>
        <div class="pagination">{$page}</div>
    </div>

</div>
<script src="__PUBLIC__/js/common.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script>
<script>
    function edit_type(id,type_id){
        layer.open({
            type: 2,
            //skin: 'layui-layer-lan',
            title: '设置类型',
            fix: false,
            shadeClose: true,
            maxmin: true,
            area: ['600px', '300px'],
            content: "<?php echo U('Admin/Message/editmestype')?>"+'&id='+id+'&type_id='+type_id,
            end: function(){
                location.reload();
            }
        });
    }
</script>
</body>
</html>